package com.java.comprehensive.other.config;

import com.java.comprehensive.other.entity.Animal;
import com.java.comprehensive.other.entity.User;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;

/**
 * @Author: 窦绍飞
 * @Date: 2022/5/28
 */
@Import(Animal.class)
@Configuration
@ImportResource("classpath:bean.xml")
@EnableConfigurationProperties(ManConfig.class)
public class MyConfig {
	@Bean("dog")
	public Animal animal() {
		return new Animal("旺财", "狗");
	}

	@ConditionalOnBean(name = "dog")
	@Bean("reply")
	public User user() {
		return new User(22, "reply");
	}


}
